import type { AppRouteModule } from '@/router/types';

import { getParentLayout, LAYOUT } from '@/router/constant';
import { t } from '@/hooks/web/useI18n';

const dashboard: AppRouteModule = {
  path: '/dashboard',
  name: 'Dashboard',
  component: LAYOUT,
  redirect: '/dashboard/workbench',
  meta: {
    orderNo: 1000,
    icon: 'ion:grid-outline',
    title: t('routes.dashboard.dashboard'),
  },
  children: [
    {
      path: 'workbench',
      name: 'WorkbenchPage',
      component: () => import('@/views/dashboard/workbench/index.vue'),
      meta: {
        affix: true,
        icon: 'carbon:workspace',
        title: t('routes.dashboard.workbench.title'),
        ignoreKeepAlive: false,
      },
    },
    {
      path: 'analysis',
      name: 'AnalysisPage',
      component: () => import('@/views/dashboard/analysis/index.vue'),
      meta: {
        icon: 'carbon:text-link-analysis',
        title: t('routes.dashboard.analysis'),
        ignoreKeepAlive: true,
      },
    },
    // =============================account start=============================
    {
      path: 'account',
      name: 'Account',
      component: getParentLayout('Account'),
      redirect: '/dashboard/account/setting',
      meta: {
        icon: 'carbon:user-profile',
        title: t('routes.dashboard.account.title'),
      },
      children: [
        {
          path: 'center',
          name: 'AccountCenterPage',
          component: () => import('@/views/dashboard/account/center/index.vue'),
          meta: {
            icon: 'iconoir:home-user',
            title: t('routes.dashboard.account.center.title'),
            ignoreKeepAlive: false,
          },
        },
        {
          path: 'setting',
          name: 'AccountSettingPage',
          component: () => import('@/views/dashboard/account/setting/index.vue'),
          meta: {
            icon: 'la:user-cog',
            title: t('routes.dashboard.account.setting.title'),
            ignoreKeepAlive: true,
          },
        },
      ],
    },
    // =============================account end=============================
  ],
};

export default dashboard;
